package com.shadt.cloud.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shadt.cloud.dao.UserDao;
import com.shadt.cloud.entity.User;
import com.shadt.cloud.service.UserService;

/**
 * 用户信息业务逻辑层实现类
 * @author SongR
 *
 */
@Service	
public class UserServiceImpl implements UserService{
	
	@Autowired
	UserDao dao;

	/**
	 * 实现根据手机号获取用户信息
	 */
	public User getByPhone(String phone) {
		String hql = "from User where phone='"+phone +"' and state != -1";
		return dao.get(hql);
	}
	/**
	 * 实现根据用户名获取用户信息
	 */
	public User getByUserName(String username) throws Exception {
		String hql = "from User where username='"+username +"' and state != -1";
		return dao.get(hql);
	}

}
